<template>
	<view class="">
		<our-loading isFullScreen :active="active" text="loading..." background-color="#ffffff" />
		<image src="../../static/dd.jpg" mode="widthFix" style="width:750rpx; height:360rpx;"></image>
		<view class="content">
			<uni-section :title="catname" mode="2" margin="2" > </uni-section>
			
			
              <view  style="height: 10px;"></view>
			  <u-alert-tips type="error"  :description="description"></u-alert-tips>
			<view class="uni-form-item uni-column">
				<view class="uni-input-wrapper zj" v-if="zj.title">
					<image :src="zj.img" mode="widthFix"></image>
					<view class="zjnl">
						<view class="name">{{zj.title}}</view>
						<view class="desc">{{zj.desc}}</view>
					</view>
				</view>
                  
                    
                    	<u-cell-item v-if="cg.title" title="成果名称" :arrow="false" :value="cg.title" ></u-cell-item>
                  	<u-cell-item v-if="xx.title" title="需求名称" :arrow="false" :value="xx.title" ></u-cell-item>

				<view class="uni-input-wrapper">
					<input class="uni-input" type="text" placeholder="您的姓名" v-model="title" />
				</view>

				<view class="uni-input-wrapper">
					<input class="uni-input" type="number" placeholder="您的手机号码" v-model="mobile" />
				</view>

				<view class="uni-textarea">
					<textarea class="uni-t" placeholder="描述您的问题" v-model="content" />
					</view>
				
				<view class="bt" @click="dd()">点击提交</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		
		data() {
			return {
				description:"",
				type:1,
				cg:{},
				xx:{},
			   catname:"",
			  title:"",
			  mobile:"",
			  content:"",
			  zj:{},
			  active:true

			}
		},
		computed:{
					webset(){
						
						return (this.$store.state.set.webset)
					}
		 },
		onLoad: function(e) {
			//console.log("订单");
			if (e.type) 
			   this.type=e.type
			if (e.type==1)
			   this.description="填写您的信息,我们会第一时间会为您联系此专家";
			if (e.type==2)
			   this.description="填写您的信息,我们会第一时间会为您联系此成果联系人";
			if (e.type==3)
			   this.description="填写您的信息,我们会第一时间会为您联系此需求联系人";
			this.catname=(this.webset.ddtypes[e.type?e.type:1])
			if (e.zjid){
				this.$H.post('zj_view', {id:e.zjid}).then(res => {
					  this.zj=res.zj
					 this.active=false
				})
				
			}else if(e.cgid){
				  
				  this.$H.post('cgview', {id:e.cgid}).then(res => {
				  	  this.cg=res.cg
				  	  this.active=false
				  })
				 
			}else if(e.xxid){
				  
				  this.$H.post('xxview', {id:e.xxid}).then(res => {
				  	  this.xx=res.xx
				  	  this.active=false
				  })
				 
			}else{
				
			 this.active=false
			}
			   
		},
		methods: {
			
			dd(){
				if (this.title==""){
					uni.showToast({
					    title: '用户名不能为空',
						icon:"none"
					});
					return
				}
				if (!this.common.ismobile(this.mobile)){
					
					uni.showToast({
					    title: '手机格式错误',
						icon:"none"
					});
					return
				}
				
				this.$H.post('dd', {
					title:this.title,
					mobile:this.mobile,
					content:this.content,
					zjid:this.zj.id?this.zj.id:0,
					cgid:this.cg.id?this.cg.id:0,
					xxid:this.xx.id?this.xx.id:0,
					type:this.type
					
				}).then(res => {
					  if (res.code==1){
						  uni.showToast({
						     title: '提交成功'
						  });
					  }else{
						  
						 uni.showToast({
						     title: res.error,
						 	 icon:"none"
						 });
					 }
				})
				
			}
		}
	}
</script>
<style>
	@import url("./index.css");
	
</style>
